package view;

import controller.OperationFile;
import controller.ToArray;
import model.FileRules;
import model.ScanRead;

/**
 * description: 管理员查看教室状态
 * author: 时间
 * time: 2022-01-12-17:38
 */
public class ListView extends ViewRun implements Rules{

    @Override
    public void views() {
        OperationFile operationFile = new OperationFile();
        ToArray toArray = new ToArray();
        String[][] strings = toArray.fileToArray(operationFile.readClassroomFile(), FileRules.pathCl, pattern2);
        System.out.println("***************************管理员界面***************************");
        System.out.println("教室号\t\t教室类型\t\t可容纳人数\t\t教室状态\t\t备注");
        for (int i = 0; i < strings.length; i++) {
            if (strings[i] != null){
                System.out.println(strings[i][0] + "\t\t" + strings[i][1] + "\t\t" + strings[i][2] + "\t\t\t" +
                        strings[i][3] + "\t\t" + strings[i][4]);
            }
        }
        System.out.println("***************************管理员界面***************************");
        ScanRead.readReturn();
        exit();
    }

    // 将flags置2
    @Override
    public void exit() {
        flags = 2;
    }
}
